package random;

import java.util.Random;
import java.util.Scanner;

public class rand {
    public static void main(String[] args) {
        Random r=new Random();
        int luckNumber=r.nextInt(100)+1;
        Scanner sc=new Scanner(System.in);
        while(true)
        {
            System.out.println("请您输入猜测的数据（1-100）：");
            int guessNumber=sc.nextInt();
            if(guessNumber>luckNumber)
            {
                System.out.println("您猜测的数据过大");
            }
            else if(guessNumber<luckNumber)
            {
                System.out.println("您猜测的数据过小");
            }
            else
            {
                System.out.println("恭喜您猜中了！");
                break;
            }
        }
    }
}

